﻿Imports DevExpress.Utils
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Imports System.Drawing
Imports System.IO

Public Class ModManifiestoBuscar
    Public Sub New()
        ' Llamada necesaria para el Diseñador de Windows Forms.
        InitializeComponent()
        ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
        ToolTipController1.ShowBeak = True
        GridControl1.ToolTipController = ToolTipController1
        ToolTipController1.ToolTipType = DevExpress.Utils.ToolTipType.SuperTip
    End Sub

    Private Sub ToolTipController1_GetActiveObjectInfo(ByVal sender As Object, ByVal e As DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs) Handles ToolTipController1.GetActiveObjectInfo
        If e.SelectedControl IsNot GridControl1 Then
            Return
        End If

        Dim info As ToolTipControlInfo = Nothing
        Dim sTooltip1 As New SuperToolTip()
        Try
            Dim view As GridView = TryCast(GridControl1.GetViewAt(e.ControlMousePosition), GridView)
            If view Is Nothing Then
                Return
            End If
            Dim hi As GridHitInfo = view.CalcHitInfo(e.ControlMousePosition)
            If hi.RowHandle < 0 Then
                Return
            End If
            info = New ToolTipControlInfo(GridHitTest.RowIndicator.ToString() & hi.RowHandle.ToString(), "Row Handle: " & hi.RowHandle.ToString())
            Dim titleItem1 As New ToolTipTitleItem()
            Dim ImageFileName As String = "\SG_Control_Vuelos\Control_Vuelos_GUI\Aerolinea.png"
            Dim image As Image
            Dim item1 As New ToolTipItem()
            ' load image
            If (Not System.IO.File.Exists(ImageFileName)) Then
                'MsgBox("Image file not found: " & ImageFileName)
            Else
                image = image.FromFile(ImageFileName)
                item1.Image = image
            End If
            item1.Text = String.Format("<b>Apellidos,Nombres </b>: {0}" & Constants.vbLf & "<b>DNI</b>: {1}" & Constants.vbLf & " <b>Aerolinea</b>:{2}" & Constants.vbLf & "<b>Origen </b>: {3}" & Constants.vbLf & "<b>Destino</b>: {4}" & Constants.vbLf & " <b>Fecha Vuelo</b>:{5}", view.GetRowCellValue(hi.RowHandle, "AppPasajero") & " " & view.GetRowCellValue(hi.RowHandle, "ApmPasajero") & "," & view.GetRowCellValue(hi.RowHandle, "NomPasajero"), view.GetRowCellValue(hi.RowHandle, "NroDocumentoId"), view.GetRowCellValue(hi.RowHandle, "NomEmpresa"), view.GetRowCellValue(hi.RowHandle, "LugarOrigen"), view.GetRowCellValue(hi.RowHandle, "LugarDestino"), view.GetRowCellValue(hi.RowHandle, "FchViaje"))
            sTooltip1.Items.Add(item1)
            info = New ToolTipControlInfo(hi.HitTest, "")
            info.SuperTip = sTooltip1
        Finally
            e.Info = info
        End Try

    End Sub
End Class
